package com.yxhl.zoume.domain.interactor.car.specialcar;

import com.yxhl.zoume.data.http.repository.car.SpecialCarRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.specialcar.SpecialCarQueryParam;
import com.yxhl.zoume.data.http.rest.response.specialcar.SpecialCarPriceQueryResponse;
import com.yxhl.zoume.domain.DomainConstants;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by sugarya on 16/4/9.
 */
public class QuerySpecialCarPriceUseCase extends com.yxhl.zoume.domain.interactor.base.UseCase<SpecialCarPriceQueryResponse> {

    private final SpecialCarRepository specialCarRepository;

    @Inject
    public QuerySpecialCarPriceUseCase(
            @Named(DomainConstants.UI_THREAD) Scheduler uiThread,
            @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
            SpecialCarRepository specialCarRepository) {
        super(uiThread, executorThread);
        this.specialCarRepository = specialCarRepository;
    }

    @Override
    protected Observable<SpecialCarPriceQueryResponse> buildObservable(RequestParamImpl param) {
        return specialCarRepository.querySpecialCarPrice((SpecialCarQueryParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
